home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1998 July / EnigmA AMIGA RUN 29 (1998)(G.R. Edizioni)(IT)[!][issue 1998-07 & 08].iso / recent / warpup1.lha / WarpUP-WarpOS / Source / tools / niceppc / niceppc.c next >
C/C++ Source or Header  |  1998-03-03  |  1KB  |  47 lines

  1. /* WarpOS tool program which modifies the NICE value of a task
  2.    specified by task ID (or the current task if no ID is given)
  3.    3.3.1998 by Sam Jordan */
  4.  
  5. #include <stdio.h>
  6. #include <exec/libraries.h>
  7. #include <dos/rdargs.h>
  8. #include <utility/tagitem.h>
  9. #include <powerpc/tasksppc.h>
  10. #include <clib/dos_protos.h>
  11. #include <clib/powerpc_protos.h>
  12.  
  13. extern struct Library* PowerPCBase;
  14. struct TaskPPC* taskptr;
  15. char template[] = "ID/K/N,NICE/N";
  16. int* array[2];
  17. struct RDArgs* result;
  18. int initialnice = 0;
  19.  
  20. void main(void)
  21. {
  22.     if (PowerPCBase->lib_Version < 14)
  23.     {
  24.         printf("Error: powerpc.library V14+ required");
  25.         return;
  26.     }
  27.     if ((result = ReadArgs(template,(LONG *)&array,NULL)) == NULL)
  28.     {
  29.         printf("Utility to set NICE values. Please specify a task ID and a NICE value.\n");
  30.         return;
  31.     }
  32.     if (array[0])
  33.         taskptr = FindTaskByID(*(array[0]));
  34.     else
  35.         taskptr = FindTaskPPC(NULL);
  36.     if (array[1])
  37.         initialnice = *(array[1]);
  38.     if (taskptr != NULL)
  39.     {
  40.         SetNiceValue(taskptr,initialnice);
  41.         printf("NICE value of task '%s' (ID=%ld) is set to %ld\n",taskptr->tp_Task.tc_Node.ln_Name,taskptr->tp_Id,initialnice);
  42.     }
  43.     else
  44.         printf("Task not found\n");
  45.     FreeArgs(result);
  46. }
  47.